/*
 * ParticipacionEventos.java
 *
 * Created on 14-oct-2008, 20:39:25
 */
package investigaciones_itm.GruposInvestigacion;

import com.sun.rave.faces.data.DefaultSelectItemsArray;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.AddRemove;
import com.sun.webui.jsf.component.Body;
import com.sun.webui.jsf.component.Calendar;
import com.sun.webui.jsf.component.Form;
import com.sun.webui.jsf.component.Head;
import com.sun.webui.jsf.component.HiddenField;
import com.sun.webui.jsf.component.Html;
import com.sun.webui.jsf.component.Link;
import com.sun.webui.jsf.component.MessageGroup;
import com.sun.webui.jsf.component.Page;
import com.sun.webui.jsf.component.PanelLayout;
import com.sun.webui.jsf.component.RadioButton;
import com.sun.webui.jsf.component.Script;
import com.sun.webui.jsf.component.Tab;
import com.sun.webui.jsf.component.TabSet;
import com.sun.webui.jsf.component.Upload;
import com.sun.webui.jsf.model.Option;
import com.sun.webui.jsf.model.UploadedFile;
import itm.exception.ArchivoException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.FacesException;
import investigaciones_itm.ApplicationBean1;
import investigaciones_itm.RequestBean1;
import investigaciones_itm.SessionBean1;
import investigaciones_itm.upload.Archivo;
import itm.bo.grupoInvestigacion.GrupoInvestigacionBO;
import itm.bo.lineaInvestigacion.LineaInvestigacionBO;
import itm.vo.file.ArchivoVO;
import itm.vo.grupoInvestigacion.CiudadVO;
import itm.vo.grupoInvestigacion.EventoPersonaGrupoVO;
import itm.vo.grupoInvestigacion.EventoVO;
import itm.vo.grupoInvestigacion.GrupoInvestigacionVO;
import itm.vo.grupoInvestigacion.PaisVO;
import itm.vo.grupoInvestigacion.TipoEventoVO;
import itm.vo.lineaInvestigacion.LineaInvestigacionVO;
import itm.vo.personas.PersonaVO;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.faces.component.UISelectItems;
import javax.faces.component.html.HtmlCommandButton;
import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlInputTextarea;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.component.html.HtmlSelectOneListbox;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import static itm.constants.FileConstants.*;

/**
 * <p>Page bean that corresponds to a similarly named JSP page.  This
 * class contains component definitions (and initialization code) for
 * all components that you have defined on this page, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.</p>
 *
 * @author Administrador
 */
public class ParticipacionEventos extends AbstractPageBean {

    String nombreArchivo = "", descripcionArchivo = "", rutaArchivo = "";
    int idEvento = 0;
    Date fechaArchivo = null;
    private HttpSession session;
    private static final String ID_SESSION_PARTICIPACION_EVENTOS = "participacion.eventos";
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">

    /**
     * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {
        //addRemoveParticipantesDefaultOptions.setOptions(new com.sun.webui.jsf.model.Option[]{});
        //addRemoveParticipantesDefaultOptions.setSelectedValue(null);
    }
    private Page page1 = new Page();

    public Page getPage1() {
        return page1;
    }

    public void setPage1(Page p) {
        this.page1 = p;
    }
    private Html html1 = new Html();

    public Html getHtml1() {
        return html1;
    }

    public void setHtml1(Html h) {
        this.html1 = h;
    }
    private Head head1 = new Head();

    public Head getHead1() {
        return head1;
    }

    public void setHead1(Head h) {
        this.head1 = h;
    }
    private Link link1 = new Link();

    public Link getLink1() {
        return link1;
    }

    public void setLink1(Link l) {
        this.link1 = l;
    }
    private Body body1 = new Body();

    public Body getBody1() {
        return body1;
    }

    public void setBody1(Body b) {
        this.body1 = b;
    }
    private Form form1 = new Form();

    public Form getForm1() {
        return form1;
    }

    public void setForm1(Form f) {
        this.form1 = f;
    }
    private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel1() {
        return gridPanel1;
    }

    public void setGridPanel1(HtmlPanelGrid hpg) {
        this.gridPanel1 = hpg;
    }
    private TabSet tabSetPartEvt = new TabSet();

    public TabSet getTabSetPartEvt() {
        return tabSetPartEvt;
    }

    public void setTabSetPartEvt(TabSet ts) {
        this.tabSetPartEvt = ts;
    }
    private Tab tabPartEvento = new Tab();

    public Tab getTabPartEvento() {
        return tabPartEvento;
    }

    public void setTabPartEvento(Tab t) {
        this.tabPartEvento = t;
    }
    private PanelLayout layoutPanel1 = new PanelLayout();

    public PanelLayout getLayoutPanel1() {
        return layoutPanel1;
    }

    public void setLayoutPanel1(PanelLayout pl) {
        this.layoutPanel1 = pl;
    }
    private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel2() {
        return gridPanel2;
    }

    public void setGridPanel2(HtmlPanelGrid hpg) {
        this.gridPanel2 = hpg;
    }
    private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel4() {
        return gridPanel4;
    }

    public void setGridPanel4(HtmlPanelGrid hpg) {
        this.gridPanel4 = hpg;
    }
    private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel5() {
        return gridPanel5;
    }

    public void setGridPanel5(HtmlPanelGrid hpg) {
        this.gridPanel5 = hpg;
    }
    private HtmlPanelGrid gridPanel10 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel10() {
        return gridPanel10;
    }

    public void setGridPanel10(HtmlPanelGrid hpg) {
        this.gridPanel10 = hpg;
    }
    private HtmlPanelGrid gridPanel11 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel11() {
        return gridPanel11;
    }

    public void setGridPanel11(HtmlPanelGrid hpg) {
        this.gridPanel11 = hpg;
    }
    private HtmlPanelGrid gridPanel13 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel13() {
        return gridPanel13;
    }

    public void setGridPanel13(HtmlPanelGrid hpg) {
        this.gridPanel13 = hpg;
    }
    private HtmlPanelGrid gridPanel14 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel14() {
        return gridPanel14;
    }

    public void setGridPanel14(HtmlPanelGrid hpg) {
        this.gridPanel14 = hpg;
    }
    private HtmlPanelGrid gridPanel16 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel16() {
        return gridPanel16;
    }

    public void setGridPanel16(HtmlPanelGrid hpg) {
        this.gridPanel16 = hpg;
    }
    private HtmlPanelGrid gridPanel17 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel17() {
        return gridPanel17;
    }

    public void setGridPanel17(HtmlPanelGrid hpg) {
        this.gridPanel17 = hpg;
    }
    private HtmlPanelGrid gridPanel19 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel19() {
        return gridPanel19;
    }

    public void setGridPanel19(HtmlPanelGrid hpg) {
        this.gridPanel19 = hpg;
    }
    private HtmlPanelGrid gridPanel20 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel20() {
        return gridPanel20;
    }

    public void setGridPanel20(HtmlPanelGrid hpg) {
        this.gridPanel20 = hpg;
    }
    private HtmlPanelGrid gridPanel22 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel22() {
        return gridPanel22;
    }

    public void setGridPanel22(HtmlPanelGrid hpg) {
        this.gridPanel22 = hpg;
    }
    private HtmlPanelGrid gridPanel23 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel23() {
        return gridPanel23;
    }

    public void setGridPanel23(HtmlPanelGrid hpg) {
        this.gridPanel23 = hpg;
    }
    private HtmlPanelGrid gridPanel25 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel25() {
        return gridPanel25;
    }

    public void setGridPanel25(HtmlPanelGrid hpg) {
        this.gridPanel25 = hpg;
    }
    private HtmlPanelGrid gridPanel26 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel26() {
        return gridPanel26;
    }

    public void setGridPanel26(HtmlPanelGrid hpg) {
        this.gridPanel26 = hpg;
    }
    private HtmlPanelGrid gridPanel28 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel28() {
        return gridPanel28;
    }

    public void setGridPanel28(HtmlPanelGrid hpg) {
        this.gridPanel28 = hpg;
    }
    private HtmlPanelGrid gridPanel29 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel29() {
        return gridPanel29;
    }

    public void setGridPanel29(HtmlPanelGrid hpg) {
        this.gridPanel29 = hpg;
    }
    private HtmlPanelGrid gridPanel31 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel31() {
        return gridPanel31;
    }

    public void setGridPanel31(HtmlPanelGrid hpg) {
        this.gridPanel31 = hpg;
    }
    private HtmlPanelGrid gridPanel32 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel32() {
        return gridPanel32;
    }

    public void setGridPanel32(HtmlPanelGrid hpg) {
        this.gridPanel32 = hpg;
    }
    private HtmlOutputText labelGrupo = new HtmlOutputText();

    public HtmlOutputText getLabelGrupo() {
        return labelGrupo;
    }

    public void setLabelGrupo(HtmlOutputText hot) {
        this.labelGrupo = hot;
    }
    private HtmlOutputText labelTipo = new HtmlOutputText();

    public HtmlOutputText getLabelTipo() {
        return labelTipo;
    }

    public void setLabelTipo(HtmlOutputText hot) {
        this.labelTipo = hot;
    }
    private HtmlSelectOneListbox listTEvento = new HtmlSelectOneListbox();

    public HtmlSelectOneListbox getListTEvento() {
        listTEvento = new HtmlSelectOneListbox();
        int idTipoEvento = 0;
        String tipoEvento = "";
        LineaInvestigacionBO lineaInvBO = new LineaInvestigacionBO();
        List<TipoEventoVO> listaTipoevento = new ArrayList<TipoEventoVO>();
        List collection = new ArrayList();
        try {
            listaTipoevento = lineaInvBO.listarTipoEventos();
            collection.add(new SelectItem(0, "Seleccione el tipo de evento"));
            for (int i = 0; i < listaTipoevento.size(); i++) {
                idTipoEvento = listaTipoevento.get(i).getIdTipoEvento();
                tipoEvento = listaTipoevento.get(i).getTipodevento();
                collection.add(new SelectItem(idTipoEvento, tipoEvento));
            } // end for
            UISelectItems listaMenu = new UISelectItems();
            listaMenu.setValue(collection);
            listTEvento.getChildren().add(listaMenu);
        } catch (Exception e) {
            e.getStackTrace();
        }
        return listTEvento;
    }

    public void setListTEvento(HtmlSelectOneListbox hsol) {
        this.listTEvento = hsol;
    }
    private UISelectItems listbox1SelectItems = new UISelectItems();

    public UISelectItems getListbox1SelectItems() {
        return listbox1SelectItems;
    }

    public void setListbox1SelectItems(UISelectItems uisi) {
        this.listbox1SelectItems = uisi;
    }
    private HtmlOutputText labelNombre = new HtmlOutputText();

    public HtmlOutputText getLabelNombre() {
        return labelNombre;
    }

    public void setLabelNombre(HtmlOutputText hot) {
        this.labelNombre = hot;
    }
    private HtmlInputText textNomEvento = new HtmlInputText();

    public HtmlInputText getTextNomEvento() {
        return textNomEvento;
    }

    public void setTextNomEvento(HtmlInputText hit) {
        this.textNomEvento = hit;
    }
    private HtmlOutputText labelPais = new HtmlOutputText();

    public HtmlOutputText getLabelPais() {
        return labelPais;
    }

    public void setLabelPais(HtmlOutputText hot) {
        this.labelPais = hot;
    }
    private HtmlSelectOneListbox listPais = new HtmlSelectOneListbox();

    public HtmlSelectOneListbox getListPais() {
        listPais = new HtmlSelectOneListbox();
        int idPais = 0;
        String pais = "";
        LineaInvestigacionBO lineaInvBO = new LineaInvestigacionBO();
        List<PaisVO> listaPais = new ArrayList<PaisVO>();
        List collection = new ArrayList();
        try {
            listaPais = lineaInvBO.listarPaises();
            collection.add(new SelectItem(0, "Seleccione un País"));
            for (int i = 0; i < listaPais.size(); i++) {
                idPais = listaPais.get(i).getIdPais();
                pais = listaPais.get(i).getPais();
                collection.add(new SelectItem(idPais, pais));
            } // end for
            UISelectItems listaMenu = new UISelectItems();
            listaMenu.setValue(collection);
            listPais.getChildren().add(listaMenu);
        } catch (Exception e) {
            e.getStackTrace();
        }
        return listPais;
    }

    public void setListPais(HtmlSelectOneListbox hsol) {
        this.listPais = hsol;
    }
    private DefaultSelectItemsArray listbox2DefaultItems = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getListbox2DefaultItems() {
        return listbox2DefaultItems;
    }

    public void setListbox2DefaultItems(DefaultSelectItemsArray dsia) {
        this.listbox2DefaultItems = dsia;
    }
    private UISelectItems listbox2SelectItems = new UISelectItems();

    public UISelectItems getListbox2SelectItems() {
        return listbox2SelectItems;
    }

    public void setListbox2SelectItems(UISelectItems uisi) {
        this.listbox2SelectItems = uisi;
    }
    private HtmlOutputText labelCiudad = new HtmlOutputText();

    public HtmlOutputText getLabelCiudad() {
        return labelCiudad;
    }

    public void setLabelCiudad(HtmlOutputText hot) {
        this.labelCiudad = hot;
    }
    private HtmlSelectOneListbox listCiudad = new HtmlSelectOneListbox();

    public HtmlSelectOneListbox getListCiudad() {
        return listCiudad;
    }

    public void setListCiudad(HtmlSelectOneListbox hsol) {
        this.listCiudad = hsol;
    }
    private DefaultSelectItemsArray listbox3DefaultItems = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getListbox3DefaultItems() {
        return listbox3DefaultItems;
    }

    public void setListbox3DefaultItems(DefaultSelectItemsArray dsia) {
        this.listbox3DefaultItems = dsia;
    }
    private UISelectItems listbox3SelectItems = new UISelectItems();

    public UISelectItems getListbox3SelectItems() {
        return listbox3SelectItems;
    }

    public void setListbox3SelectItems(UISelectItems uisi) {
        this.listbox3SelectItems = uisi;
    }
    private HtmlOutputText labelOrganizador = new HtmlOutputText();

    public HtmlOutputText getLabelOrganizador() {
        return labelOrganizador;
    }

    public void setLabelOrganizador(HtmlOutputText hot) {
        this.labelOrganizador = hot;
    }
    private HtmlInputText textOrganizador = new HtmlInputText();

    public HtmlInputText getTextOrganizador() {
        return textOrganizador;
    }

    public void setTextOrganizador(HtmlInputText hit) {
        this.textOrganizador = hit;
    }
    private HtmlOutputText labelFechaInicio = new HtmlOutputText();

    public HtmlOutputText getLabelFechaInicio() {
        return labelFechaInicio;
    }

    public void setLabelFechaInicio(HtmlOutputText hot) {
        this.labelFechaInicio = hot;
    }
    private HtmlOutputText labelFechaFin = new HtmlOutputText();

    public HtmlOutputText getLabelFechaFin() {
        return labelFechaFin;
    }

    public void setLabelFechaFin(HtmlOutputText hot) {
        this.labelFechaFin = hot;
    }
    private HtmlOutputText labelDuracion = new HtmlOutputText();

    public HtmlOutputText getLabelDuracion() {
        return labelDuracion;
    }

    public void setLabelDuracion(HtmlOutputText hot) {
        this.labelDuracion = hot;
    }
    private Calendar calendarioInicio = new Calendar();

    public Calendar getCalendarioInicio() {
        return calendarioInicio;
    }

    public void setCalendarioInicio(Calendar c) {
        this.calendarioInicio = c;
    }
    private Calendar calendarioFin = new Calendar();

    public Calendar getCalendarioFin() {
        return calendarioFin;
    }

    public void setCalendarioFin(Calendar c) {
        this.calendarioFin = c;
    }
    private HtmlInputText textDuracion = new HtmlInputText();

    public HtmlInputText getTextDuracion() {
        return textDuracion;
    }

    public void setTextDuracion(HtmlInputText hit) {
        this.textDuracion = hit;
    }
    private HtmlSelectOneListbox listTiempo = new HtmlSelectOneListbox();

    public HtmlSelectOneListbox getListTiempo() {
        listTiempo = new HtmlSelectOneListbox();
        List collection = new ArrayList();

        collection.add(new SelectItem("Horas", "Horas"));
        collection.add(new SelectItem("Días", "Días"));
        collection.add(new SelectItem("Semanas", "Semanas"));
        UISelectItems listaMenu = new UISelectItems();
        listaMenu.setValue(collection);
        listTiempo.getChildren().add(listaMenu);

        return listTiempo;
    }

    public void setListTiempo(HtmlSelectOneListbox hsol) {
        this.listTiempo = hsol;
    }
    private DefaultSelectItemsArray listbox4DefaultItems = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getListbox4DefaultItems() {
        return listbox4DefaultItems;
    }

    public void setListbox4DefaultItems(DefaultSelectItemsArray dsia) {
        this.listbox4DefaultItems = dsia;
    }
    private UISelectItems listboxSelectTiempo = new UISelectItems();

    public UISelectItems getListboxSelectTiempo() {
        return listboxSelectTiempo;
    }

    public void setListboxSelectTiempo(UISelectItems uisi) {
        this.listboxSelectTiempo = uisi;
    }
    private HtmlPanelGrid gridPanel34 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel34() {
        return gridPanel34;
    }

    public void setGridPanel34(HtmlPanelGrid hpg) {
        this.gridPanel34 = hpg;
    }
    private HtmlOutputText outputTextCosPer = new HtmlOutputText();

    public HtmlOutputText getOutputTextCosPer() {
        return outputTextCosPer;
    }

    public void setOutputTextCosPer(HtmlOutputText hot) {
        this.outputTextCosPer = hot;
    }
    private HtmlPanelGrid gridPanel35 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel35() {
        return gridPanel35;
    }

    public void setGridPanel35(HtmlPanelGrid hpg) {
        this.gridPanel35 = hpg;
    }
    private HtmlInputText textCostpersona = new HtmlInputText();

    public HtmlInputText getTextCostpersona() {
        return textCostpersona;
    }

    public void setTextCostpersona(HtmlInputText hit) {
        this.textCostpersona = hit;
    }
    private HtmlPanelGrid gridPanel37 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel37() {
        return gridPanel37;
    }

    public void setGridPanel37(HtmlPanelGrid hpg) {
        this.gridPanel37 = hpg;
    }
    private HtmlPanelGrid gridPanel38 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel38() {
        return gridPanel38;
    }

    public void setGridPanel38(HtmlPanelGrid hpg) {
        this.gridPanel38 = hpg;
    }
    private HtmlPanelGrid gridPanel40 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel40() {
        return gridPanel40;
    }

    public void setGridPanel40(HtmlPanelGrid hpg) {
        this.gridPanel40 = hpg;
    }
    private HtmlPanelGrid gridPanel41 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel41() {
        return gridPanel41;
    }

    public void setGridPanel41(HtmlPanelGrid hpg) {
        this.gridPanel41 = hpg;
    }
    private HtmlPanelGrid gridPanel42 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel42() {
        return gridPanel42;
    }

    public void setGridPanel42(HtmlPanelGrid hpg) {
        this.gridPanel42 = hpg;
    }
    private HtmlPanelGrid gridPanel43 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel43() {
        return gridPanel43;
    }

    public void setGridPanel43(HtmlPanelGrid hpg) {
        this.gridPanel43 = hpg;
    }
    private HtmlPanelGrid gridPanel44 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel44() {
        return gridPanel44;
    }

    public void setGridPanel44(HtmlPanelGrid hpg) {
        this.gridPanel44 = hpg;
    }
    private HtmlPanelGrid gridPanel46 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel46() {
        return gridPanel46;
    }

    public void setGridPanel46(HtmlPanelGrid hpg) {
        this.gridPanel46 = hpg;
    }
    private HtmlPanelGrid gridPanel47 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel47() {
        return gridPanel47;
    }

    public void setGridPanel47(HtmlPanelGrid hpg) {
        this.gridPanel47 = hpg;
    }
    private HtmlPanelGrid gridPanel49 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel49() {
        return gridPanel49;
    }

    public void setGridPanel49(HtmlPanelGrid hpg) {
        this.gridPanel49 = hpg;
    }
    private HtmlPanelGrid gridPanel50 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel50() {
        return gridPanel50;
    }

    public void setGridPanel50(HtmlPanelGrid hpg) {
        this.gridPanel50 = hpg;
    }
    private HtmlPanelGrid gridPanel52 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel52() {
        return gridPanel52;
    }

    public void setGridPanel52(HtmlPanelGrid hpg) {
        this.gridPanel52 = hpg;
    }
    private HtmlPanelGrid gridPanel53 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel53() {
        return gridPanel53;
    }

    public void setGridPanel53(HtmlPanelGrid hpg) {
        this.gridPanel53 = hpg;
    }
    private HtmlPanelGrid gridPanel55 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel55() {
        return gridPanel55;
    }

    public void setGridPanel55(HtmlPanelGrid hpg) {
        this.gridPanel55 = hpg;
    }
    private HtmlPanelGrid gridPanel56 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel56() {
        return gridPanel56;
    }

    public void setGridPanel56(HtmlPanelGrid hpg) {
        this.gridPanel56 = hpg;
    }
    private HtmlPanelGrid gridPanel58 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel58() {
        return gridPanel58;
    }

    public void setGridPanel58(HtmlPanelGrid hpg) {
        this.gridPanel58 = hpg;
    }
    private HtmlPanelGrid gridPanel59 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel59() {
        return gridPanel59;
    }

    public void setGridPanel59(HtmlPanelGrid hpg) {
        this.gridPanel59 = hpg;
    }
    private HtmlPanelGrid gridPanel61 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel61() {
        return gridPanel61;
    }

    public void setGridPanel61(HtmlPanelGrid hpg) {
        this.gridPanel61 = hpg;
    }
    private HtmlPanelGrid gridPanel62 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel62() {
        return gridPanel62;
    }

    public void setGridPanel62(HtmlPanelGrid hpg) {
        this.gridPanel62 = hpg;
    }
    private HtmlPanelGrid gridPanel63 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel63() {
        return gridPanel63;
    }

    public void setGridPanel63(HtmlPanelGrid hpg) {
        this.gridPanel63 = hpg;
    }
    private HtmlOutputText outputDetalle = new HtmlOutputText();

    public HtmlOutputText getOutputDetalle() {
        return outputDetalle;
    }

    public void setOutputDetalle(HtmlOutputText hot) {
        this.outputDetalle = hot;
    }
    private HtmlOutputText outputAsume = new HtmlOutputText();

    public HtmlOutputText getOutputAsume() {
        return outputAsume;
    }

    public void setOutputAsume(HtmlOutputText hot) {
        this.outputAsume = hot;
    }
    private HtmlOutputText outputLineaInv = new HtmlOutputText();

    public HtmlOutputText getOutputLineaInv() {
        return outputLineaInv;
    }

    public void setOutputLineaInv(HtmlOutputText hot) {
        this.outputLineaInv = hot;
    }
    private HtmlOutputText outputJustificacion = new HtmlOutputText();

    public HtmlOutputText getOutputJustificacion() {
        return outputJustificacion;
    }

    public void setOutputJustificacion(HtmlOutputText hot) {
        this.outputJustificacion = hot;
    }
    private HtmlOutputText outputDescripcion = new HtmlOutputText();

    public HtmlOutputText getOutputDescripcion() {
        return outputDescripcion;
    }

    public void setOutputDescripcion(HtmlOutputText hot) {
        this.outputDescripcion = hot;
    }
    private HtmlOutputText outputText2 = new HtmlOutputText();

    public HtmlOutputText getOutputText2() {
        return outputText2;
    }

    public void setOutputText2(HtmlOutputText hot) {
        this.outputText2 = hot;
    }
    private HtmlOutputText outputAporte = new HtmlOutputText();

    public HtmlOutputText getOutputAporte() {
        return outputAporte;
    }

    public void setOutputAporte(HtmlOutputText hot) {
        this.outputAporte = hot;
    }
    private HtmlOutputText outputBeneficios = new HtmlOutputText();

    public HtmlOutputText getOutputBeneficios() {
        return outputBeneficios;
    }

    public void setOutputBeneficios(HtmlOutputText hot) {
        this.outputBeneficios = hot;
    }
    private HtmlOutputText outputAprobacion = new HtmlOutputText();

    public HtmlOutputText getOutputAprobacion() {
        return outputAprobacion;
    }

    public void setOutputAprobacion(HtmlOutputText hot) {
        this.outputAprobacion = hot;
    }
    private HtmlInputTextarea textAreadetalle = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreadetalle() {
        return textAreadetalle;
    }

    public void setTextAreadetalle(HtmlInputTextarea hit) {
        this.textAreadetalle = hit;
    }
    private HtmlInputText textFieldAsume = new HtmlInputText();

    public HtmlInputText getTextFieldAsume() {
        return textFieldAsume;
    }

    public void setTextFieldAsume(HtmlInputText hit) {
        this.textFieldAsume = hit;
    }
    private HtmlSelectOneListbox listboxLinea = new HtmlSelectOneListbox();

    public HtmlSelectOneListbox getListboxLinea() {
        listboxLinea = new HtmlSelectOneListbox();
        int idLinea = 0;
        String nombreLinea = "";
        LineaInvestigacionBO lineaInvBO = new LineaInvestigacionBO();
        List<LineaInvestigacionVO> listaLinea = new ArrayList<LineaInvestigacionVO>();
        List collection = new ArrayList();
        try {
            listaLinea = lineaInvBO.listarLineas();
            collection.add(new SelectItem(0, "Seleccione una Línea"));
            for (int i = 0; i < listaLinea.size(); i++) {
                idLinea = listaLinea.get(i).getIdLinea();
                nombreLinea = listaLinea.get(i).getNombreLinea();
                collection.add(new SelectItem(idLinea, nombreLinea));
            } // end for
            UISelectItems listaMenu = new UISelectItems();
            listaMenu.setValue(collection);

            listboxLinea.getChildren().add(listaMenu);
        } catch (Exception e) {
            e.getStackTrace();
        }
        return listboxLinea;
    }

    public void setListboxLinea(HtmlSelectOneListbox hsol) {
        this.listboxLinea = hsol;
    }
    private DefaultSelectItemsArray listbox1DefaultItems1 = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getListbox1DefaultItems1() {
        return listbox1DefaultItems1;
    }

    public void setListbox1DefaultItems1(DefaultSelectItemsArray dsia) {
        this.listbox1DefaultItems1 = dsia;
    }
    private UISelectItems listbox1SelectItems1 = new UISelectItems();

    public UISelectItems getListbox1SelectItems1() {
        return listbox1SelectItems1;
    }

    public void setListbox1SelectItems1(UISelectItems uisi) {
        this.listbox1SelectItems1 = uisi;
    }
    private DefaultSelectItemsArray listTEventoDefaultItems = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getListTEventoDefaultItems() {
        return listTEventoDefaultItems;
    }

    public void setListTEventoDefaultItems(DefaultSelectItemsArray dsia) {
        this.listTEventoDefaultItems = dsia;
    }
    private DefaultSelectItemsArray listbox1DefaultItems2 = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getListbox1DefaultItems2() {
        return listbox1DefaultItems2;
    }

    public void setListbox1DefaultItems2(DefaultSelectItemsArray dsia) {
        this.listbox1DefaultItems2 = dsia;
    }
    private DefaultSelectItemsArray listbox1DefaultItems3 = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getListbox1DefaultItems3() {
        return listbox1DefaultItems3;
    }

    public void setListbox1DefaultItems3(DefaultSelectItemsArray dsia) {
        this.listbox1DefaultItems3 = dsia;
    }
    private HtmlInputTextarea textAreaJust = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreaJust() {
        return textAreaJust;
    }

    public void setTextAreaJust(HtmlInputTextarea hit) {
        this.textAreaJust = hit;
    }
    private HtmlInputTextarea textAreaDesc = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreaDesc() {
        return textAreaDesc;
    }

    public void setTextAreaDesc(HtmlInputTextarea hit) {
        this.textAreaDesc = hit;
    }
    private HtmlInputTextarea textAreaImport = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreaImport() {
        return textAreaImport;
    }

    public void setTextAreaImport(HtmlInputTextarea hit) {
        this.textAreaImport = hit;
    }
    private HtmlInputTextarea textAreaAporte = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreaAporte() {
        return textAreaAporte;
    }

    public void setTextAreaAporte(HtmlInputTextarea hit) {
        this.textAreaAporte = hit;
    }
    private HtmlInputTextarea textAreaBeneficios = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreaBeneficios() {
        return textAreaBeneficios;
    }

    public void setTextAreaBeneficios(HtmlInputTextarea hit) {
        this.textAreaBeneficios = hit;
    }
    private HtmlInputText textFieldAprob = new HtmlInputText();

    public HtmlInputText getTextFieldAprob() {
        return textFieldAprob;
    }

    public void setTextFieldAprob(HtmlInputText hit) {
        this.textFieldAprob = hit;
    }
    private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel8() {
        return gridPanel8;
    }

    public void setGridPanel8(HtmlPanelGrid hpg) {
        this.gridPanel8 = hpg;
    }
    private HtmlPanelGrid gridPanel9 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel9() {
        return gridPanel9;
    }

    public void setGridPanel9(HtmlPanelGrid hpg) {
        this.gridPanel9 = hpg;
    }
    private HtmlOutputText outputPartic = new HtmlOutputText();

    public HtmlOutputText getOutputPartic() {
        return outputPartic;
    }

    public void setOutputPartic(HtmlOutputText hot) {
        this.outputPartic = hot;
    }
    private HtmlCommandButton botonGuardar = new HtmlCommandButton();

    public HtmlCommandButton getBotonGuardar() {
        return botonGuardar;
    }

    public void setBotonGuardar(HtmlCommandButton hcb) {
        this.botonGuardar = hcb;
    }
    private HtmlCommandButton botonCancelar = new HtmlCommandButton();

    public HtmlCommandButton getBotonCancelar() {
        return botonCancelar;
    }

    public void setBotonCancelar(HtmlCommandButton hcb) {
        this.botonCancelar = hcb;
    }
    private HiddenField hiddenIdGrupo = new HiddenField();

    public HiddenField getHiddenIdGrupo() {
        return hiddenIdGrupo;
    }

    public void setHiddenIdGrupo(HiddenField hf) {
        this.hiddenIdGrupo = hf;
    }
    private HtmlPanelGrid gridPanel65 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel65() {
        return gridPanel65;
    }

    public void setGridPanel65(HtmlPanelGrid hpg) {
        this.gridPanel65 = hpg;
    }
    private MessageGroup messageGroup1 = new MessageGroup();

    public MessageGroup getMessageGroup1() {
        return messageGroup1;
    }

    public void setMessageGroup1(MessageGroup mg) {
        this.messageGroup1 = mg;
    }
    private DefaultSelectItemsArray multiSelectListbox1DefaultItems1 = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getMultiSelectListbox1DefaultItems1() {
        return multiSelectListbox1DefaultItems1;
    }

    public void setMultiSelectListbox1DefaultItems1(DefaultSelectItemsArray dsia) {
        this.multiSelectListbox1DefaultItems1 = dsia;
    }
    private UISelectItems multiSelectListbox1SelectItems = new UISelectItems();

    public UISelectItems getMultiSelectListbox1SelectItems() {
        return multiSelectListbox1SelectItems;
    }

    public void setMultiSelectListbox1SelectItems(UISelectItems uisi) {
        this.multiSelectListbox1SelectItems = uisi;
    }
    private DefaultSelectItemsArray multiSelectListbox1DefaultItems2 = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getMultiSelectListbox1DefaultItems2() {
        return multiSelectListbox1DefaultItems2;
    }

    public void setMultiSelectListbox1DefaultItems2(DefaultSelectItemsArray dsia) {
        this.multiSelectListbox1DefaultItems2 = dsia;
    }
    private DefaultSelectItemsArray multiSelectListbox1DefaultItems3 = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getMultiSelectListbox1DefaultItems3() {
        return multiSelectListbox1DefaultItems3;
    }

    public void setMultiSelectListbox1DefaultItems3(DefaultSelectItemsArray dsia) {
        this.multiSelectListbox1DefaultItems3 = dsia;
    }
    private DefaultSelectItemsArray multiSelectListbox2DefaultItems = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getMultiSelectListbox2DefaultItems() {
        return multiSelectListbox2DefaultItems;
    }

    public void setMultiSelectListbox2DefaultItems(DefaultSelectItemsArray dsia) {
        this.multiSelectListbox2DefaultItems = dsia;
    }
    private UISelectItems multiSelectListbox2SelectItems = new UISelectItems();

    public UISelectItems getMultiSelectListbox2SelectItems() {
        return multiSelectListbox2SelectItems;
    }

    public void setMultiSelectListbox2SelectItems(UISelectItems uisi) {
        this.multiSelectListbox2SelectItems = uisi;
    }
    private HtmlInputTextarea areaNombreGrupo = new HtmlInputTextarea();

    public HtmlInputTextarea getAreaNombreGrupo() {
        return areaNombreGrupo;
    }

    public void setAreaNombreGrupo(HtmlInputTextarea hit) {
        this.areaNombreGrupo = hit;
    }
    private Script script1 = new Script();

    public Script getScript1() {
        return script1;
    }

    public void setScript1(Script s) {
        this.script1 = s;
    }
    private HtmlPanelGrid gridPanel67 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel67() {
        return gridPanel67;
    }

    public void setGridPanel67(HtmlPanelGrid hpg) {
        this.gridPanel67 = hpg;
    }
    private DefaultSelectItemsArray radioButtonList1DefaultItems = new DefaultSelectItemsArray();

    public DefaultSelectItemsArray getRadioButtonList1DefaultItems() {
        return radioButtonList1DefaultItems;
    }

    public void setRadioButtonList1DefaultItems(DefaultSelectItemsArray dsia) {
        this.radioButtonList1DefaultItems = dsia;
    }
    private RadioButton allnone = new RadioButton();

    public RadioButton getAllnone() {
        return allnone;
    }

    public void setAllnone(RadioButton rb) {
        this.allnone = rb;
    }
    private RadioButton allnone1 = new RadioButton();

    public RadioButton getAllnone1() {
        return allnone1;
    }

    public void setAllnone1(RadioButton rb) {
        this.allnone1 = rb;
    }
    private AddRemove addRemoveParticipantes = new AddRemove();

    public AddRemove getAddRemoveParticipantes() {
        return addRemoveParticipantes;
    }

    public void setAddRemoveParticipantes(AddRemove ar) {
        this.addRemoveParticipantes = ar;
    }
    /** Holds value of property availableOptions. */
    private Option[] availableOptions = null;
    /** Holds value of property selectedOptions. */
    private String[] selectedOptions = null;

    public Option[] getAvailableOptions() {
        return availableOptions;
    }

    public void setAvailableOptions(Option[] availableOptions) {
        this.availableOptions = availableOptions;
    }

    public String[] getSelectedOptions() {
        return selectedOptions;
    }

    public void setSelectedOptions(String[] selectedOptions) {
        this.selectedOptions = selectedOptions;
    }
    private Tab tabAnexo = new Tab();

    public Tab getTabAnexo() {
        return tabAnexo;
    }

    public void setTabAnexo(Tab t) {
        this.tabAnexo = t;
    }
    private PanelLayout layoutPanel2 = new PanelLayout();

    public PanelLayout getLayoutPanel2() {
        return layoutPanel2;
    }

    public void setLayoutPanel2(PanelLayout pl) {
        this.layoutPanel2 = pl;
    }
    private HtmlPanelGrid gridPanel66 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel66() {
        return gridPanel66;
    }

    public void setGridPanel66(HtmlPanelGrid hpg) {
        this.gridPanel66 = hpg;
    }
    private HtmlPanelGrid gridPanel68 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel68() {
        return gridPanel68;
    }

    public void setGridPanel68(HtmlPanelGrid hpg) {
        this.gridPanel68 = hpg;
    }
    private HtmlPanelGrid gridPanel69 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel69() {
        return gridPanel69;
    }

    public void setGridPanel69(HtmlPanelGrid hpg) {
        this.gridPanel69 = hpg;
    }
    private HtmlPanelGrid gridPanel70 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel70() {
        return gridPanel70;
    }

    public void setGridPanel70(HtmlPanelGrid hpg) {
        this.gridPanel70 = hpg;
    }
    private HtmlPanelGrid gridPanel71 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel71() {
        return gridPanel71;
    }

    public void setGridPanel71(HtmlPanelGrid hpg) {
        this.gridPanel71 = hpg;
    }
    private HtmlPanelGrid gridPanel72 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel72() {
        return gridPanel72;
    }

    public void setGridPanel72(HtmlPanelGrid hpg) {
        this.gridPanel72 = hpg;
    }
    private HtmlPanelGrid gridPanel73 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel73() {
        return gridPanel73;
    }

    public void setGridPanel73(HtmlPanelGrid hpg) {
        this.gridPanel73 = hpg;
    }
    private HtmlPanelGrid gridPanel74 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel74() {
        return gridPanel74;
    }

    public void setGridPanel74(HtmlPanelGrid hpg) {
        this.gridPanel74 = hpg;
    }
    private HtmlPanelGrid gridPanel75 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel75() {
        return gridPanel75;
    }

    public void setGridPanel75(HtmlPanelGrid hpg) {
        this.gridPanel75 = hpg;
    }
    private HtmlPanelGrid gridPanel76 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel76() {
        return gridPanel76;
    }

    public void setGridPanel76(HtmlPanelGrid hpg) {
        this.gridPanel76 = hpg;
    }
    private HtmlPanelGrid gridPanel77 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel77() {
        return gridPanel77;
    }

    public void setGridPanel77(HtmlPanelGrid hpg) {
        this.gridPanel77 = hpg;
    }
    private HtmlPanelGrid gridPanel78 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel78() {
        return gridPanel78;
    }

    public void setGridPanel78(HtmlPanelGrid hpg) {
        this.gridPanel78 = hpg;
    }
    private HtmlPanelGrid gridPanel79 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel79() {
        return gridPanel79;
    }

    public void setGridPanel79(HtmlPanelGrid hpg) {
        this.gridPanel79 = hpg;
    }
    private HtmlPanelGrid gridPanel80 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel80() {
        return gridPanel80;
    }

    public void setGridPanel80(HtmlPanelGrid hpg) {
        this.gridPanel80 = hpg;
    }
    private HtmlPanelGrid gridPanel81 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel81() {
        return gridPanel81;
    }

    public void setGridPanel81(HtmlPanelGrid hpg) {
        this.gridPanel81 = hpg;
    }
    private HtmlPanelGrid gridPanel82 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel82() {
        return gridPanel82;
    }

    public void setGridPanel82(HtmlPanelGrid hpg) {
        this.gridPanel82 = hpg;
    }
    private HtmlPanelGrid gridPanel83 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel83() {
        return gridPanel83;
    }

    public void setGridPanel83(HtmlPanelGrid hpg) {
        this.gridPanel83 = hpg;
    }
    private MessageGroup messageGroup2 = new MessageGroup();

    public MessageGroup getMessageGroup2() {
        return messageGroup2;
    }

    public void setMessageGroup2(MessageGroup mg) {
        this.messageGroup2 = mg;
    }
    private HtmlOutputText outputText1 = new HtmlOutputText();

    public HtmlOutputText getOutputText1() {
        return outputText1;
    }

    public void setOutputText1(HtmlOutputText hot) {
        this.outputText1 = hot;
    }
    private HtmlOutputText outputText3 = new HtmlOutputText();

    public HtmlOutputText getOutputText3() {
        return outputText3;
    }

    public void setOutputText3(HtmlOutputText hot) {
        this.outputText3 = hot;
    }
    private HtmlOutputText outputText4 = new HtmlOutputText();

    public HtmlOutputText getOutputText4() {
        return outputText4;
    }

    public void setOutputText4(HtmlOutputText hot) {
        this.outputText4 = hot;
    }
    private HtmlOutputText outputText5 = new HtmlOutputText();

    public HtmlOutputText getOutputText5() {
        return outputText5;
    }

    public void setOutputText5(HtmlOutputText hot) {
        this.outputText5 = hot;
    }
    private HtmlOutputText outputText7 = new HtmlOutputText();

    public HtmlOutputText getOutputText7() {
        return outputText7;
    }

    public void setOutputText7(HtmlOutputText hot) {
        this.outputText7 = hot;
    }
    private HtmlOutputText outputText8 = new HtmlOutputText();

    public HtmlOutputText getOutputText8() {
        return outputText8;
    }

    public void setOutputText8(HtmlOutputText hot) {
        this.outputText8 = hot;
    }
    private HtmlInputText textFieldIdGrupo = new HtmlInputText();

    public HtmlInputText getTextFieldIdGrupo() {
        return textFieldIdGrupo;
    }

    public void setTextFieldIdGrupo(HtmlInputText hit) {
        this.textFieldIdGrupo = hit;
    }
    private HtmlInputTextarea textAreaNombreGrupo = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreaNombreGrupo() {
        return textAreaNombreGrupo;
    }

    public void setTextAreaNombreGrupo(HtmlInputTextarea hit) {
        this.textAreaNombreGrupo = hit;
    }
    private HtmlInputText textNombreArchivo = new HtmlInputText();

    public HtmlInputText getTextNombreArchivo() {
        return textNombreArchivo;
    }

    public void setTextNombreArchivo(HtmlInputText hit) {
        this.textNombreArchivo = hit;
    }
    private HtmlInputTextarea textAreaDescripcionArchivo = new HtmlInputTextarea();

    public HtmlInputTextarea getTextAreaDescripcionArchivo() {
        return textAreaDescripcionArchivo;
    }

    public void setTextAreaDescripcionArchivo(HtmlInputTextarea hit) {
        this.textAreaDescripcionArchivo = hit;
    }
    private Upload fileUploadAnexo = new Upload();

    public Upload getFileUploadAnexo() {
        return fileUploadAnexo;
    }

    public void setFileUploadAnexo(Upload u) {
        this.fileUploadAnexo = u;
    }
    private HtmlCommandButton botonAdjuntar = new HtmlCommandButton();

    public HtmlCommandButton getBotonAdjuntar() {
        return botonAdjuntar;
    }

    public void setBotonAdjuntar(HtmlCommandButton hcb) {
        this.botonAdjuntar = hcb;
    }
    private HtmlInputText textFieldArchivoAdjunto = new HtmlInputText();

    public HtmlInputText getTextFieldArchivoAdjunto() {
        return textFieldArchivoAdjunto;
    }

    public void setTextFieldArchivoAdjunto(HtmlInputText hit) {
        this.textFieldArchivoAdjunto = hit;
    }
    private HtmlInputText textFieldFechaArchivo = new HtmlInputText();

    public HtmlInputText getTextFieldFechaArchivo() {
        textFieldFechaArchivo = new HtmlInputText();
        java.util.Date fechaActual = new java.util.Date();
        fechaActual = new Date(fechaActual.getTime());
        textFieldFechaArchivo.setValue(fechaActual);
        return textFieldFechaArchivo;
    }

    public void setTextFieldFechaArchivo(HtmlInputText hit) {
        this.textFieldFechaArchivo = hit;
    }
    private HtmlPanelGrid gridPanel84 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel84() {
        return gridPanel84;
    }

    public void setGridPanel84(HtmlPanelGrid hpg) {
        this.gridPanel84 = hpg;
    }
    private HtmlPanelGrid gridPanel85 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel85() {
        return gridPanel85;
    }

    public void setGridPanel85(HtmlPanelGrid hpg) {
        this.gridPanel85 = hpg;
    }
    private HtmlCommandButton botonGuardarArchivo = new HtmlCommandButton();

    public HtmlCommandButton getBotonGuardarArchivo() {
        return botonGuardarArchivo;
    }

    public void setBotonGuardarArchivo(HtmlCommandButton hcb) {
        this.botonGuardarArchivo = hcb;
    }
    private HtmlCommandButton botonVolver = new HtmlCommandButton();

    public HtmlCommandButton getBotonVolver() {
        return botonVolver;
    }

    public void setBotonVolver(HtmlCommandButton hcb) {
        this.botonVolver = hcb;
    }
    private HtmlInputText textFieldIdEvento = new HtmlInputText();

    public HtmlInputText getTextFieldIdEvento() {
        return textFieldIdEvento;
    }

    public void setTextFieldIdEvento(HtmlInputText hit) {
        this.textFieldIdEvento = hit;
    }
    private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel3() {
        return gridPanel3;
    }

    public void setGridPanel3(HtmlPanelGrid hpg) {
        this.gridPanel3 = hpg;
    }
    private HtmlCommandButton buttonAnexarInfo = new HtmlCommandButton();

    public HtmlCommandButton getButtonAnexarInfo() {
        return buttonAnexarInfo;
    }

    public void setButtonAnexarInfo(HtmlCommandButton hcb) {
        this.buttonAnexarInfo = hcb;
    }


    // </editor-fold>
    /**
     * <p>Construct a new Page bean instance.</p>
     */
    public ParticipacionEventos() {
        GrupoInvestigacionVO grupoInvestigacionVO = getRequestBean1().getGrupoInvVO();
        hiddenIdGrupo.setValue(grupoInvestigacionVO.getIdGrupo());
        areaNombreGrupo.setValue(grupoInvestigacionVO.getNombreGrupo());
        textFieldIdGrupo.setValue(grupoInvestigacionVO.getIdGrupo());
        textAreaNombreGrupo.setValue(grupoInvestigacionVO.getNombreGrupo());
        cargarVariablesSession();
    }

    private void cargarVariablesSession(){

         if(this.getSession().getAttribute(ID_SESSION_PARTICIPACION_EVENTOS+"availableOptions")!=null){
            this.setAvailableOptions((Option[]) this.getSession().getAttribute(ID_SESSION_PARTICIPACION_EVENTOS+"availableOptions"));
        }

    }

    /**
     * <p>Callback method that is called whenever a page is navigated to,
     * either directly via a URL, or indirectly via page navigation.
     * Customize this method to acquire resources that will be needed
     * for event handlers and lifecycle methods, whether or not this
     * page is performing post back processing.</p>
     * 
     * <p>Note that, if the current request is a postback, the property
     * values of the components do <strong>not</strong> represent any
     * values submitted with this request.  Instead, they represent the
     * property values that were saved for this view when it was rendered.</p>
     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here

        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("ParticipacionEventos Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
        }

    // </editor-fold>
    // Perform application initialization that must complete
    // *after* managed components are initialized
    // TODO - add your own initialization code here
    }

    /**
     * <p>Callback method that is called after the component tree has been
     * restored, but before any event processing takes place.  This method
     * will <strong>only</strong> be called on a postback request that
     * is processing a form submit.  Customize this method to allocate
     * resources that will be required in your event handlers.</p>
     */
    @Override
    public void preprocess() {
    }

    /**
     * <p>Callback method that is called just before rendering takes place.
     * This method will <strong>only</strong> be called for the page that
     * will actually be rendered (and not, for example, on a page that
     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.</p>
     */
    @Override
    public void prerender() {
        GrupoInvestigacionVO grupoInvestigacionVO = getRequestBean1().getGrupoInvVO();
        if(grupoInvestigacionVO.getIdGrupo()!=0){
        String idPersona = "";
        String nombrePersona = "";
        grupoInvBO = new GrupoInvestigacionBO();
        List<PersonaVO> listaPersonas = new ArrayList<PersonaVO>();
        try {
            listaPersonas = grupoInvBO.listarPersonasByGrupoPK(grupoInvestigacionVO);
            Option[] opcion = new Option[listaPersonas.size()];
            for (int i = 0; i < listaPersonas.size(); i++) {
                idPersona = listaPersonas.get(i).getIdPersona();
                nombrePersona = listaPersonas.get(i).getNombrePersona();
                opcion[i] = new Option(idPersona, nombrePersona);
                
            } // end for
            availableOptions = opcion;
            this.getSession().setAttribute(ID_SESSION_PARTICIPACION_EVENTOS+"availableOptions", this.getAvailableOptions());
            
        } catch (Exception e) {
            e.getStackTrace();
        }
        }

    }

    /**
     * <p>Callback method that is called after rendering is completed for
     * this request, if <code>init()</code> was called (regardless of whether
     * or not this was the page that was actually rendered).  Customize this
     * method to release resources acquired in the <code>init()</code>,
     * <code>preprocess()</code>, or <code>prerender()</code> methods (or
     * acquired during execution of an event handler).</p>
     */
    @Override
    public void destroy() {
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1) getBean("ApplicationBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected RequestBean1 getRequestBean1() {
        return (RequestBean1) getBean("RequestBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected SessionBean1 getSessionBean1() {
        return (SessionBean1) getBean("SessionBean1");
    }

    public String botonCancelar_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        return "consultarGrupo";
    }
    public GrupoInvestigacionBO grupoInvBO;
    public GrupoInvestigacionVO grupoInvVO;
    public EventoPersonaGrupoVO eventoPersonaGrupoVO;
    public EventoVO eventoVO;
    public ArchivoVO archivoVO;
    int idLinea = 0, idGrupo = 0, idTipoEvento = 0, idPais = 0, idCiudad = 0;
    String nombreEvento = "", organizador = "", duracion = "", listDur = "", costoXPersona = "";
    String detalleCosto = "", asumeCosto = "", justificacion = "", descripcion = "";
    String importanciaITM = "", aporteAProyectosInternos = "", beneficios = "", aprobacion = "";
    Date fechaInicio = null, fechaFin = null, fechaActual = null;

    public String botonGuardar_action() throws Exception {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        //hiddenIdGrupo.setValue(hiddenIdGrupo.getValue());
        String resultadoParticipantes = "";
        int resultado = 0;
        try {
            grupoInvBO = new GrupoInvestigacionBO();
            eventoVO = new EventoVO();

            String idLine = (String) listboxLinea.getValue();
            idLinea = Integer.parseInt(idLine);

            idGrupo = (Integer) hiddenIdGrupo.getValue();

            String idCountry = (String) listPais.getValue();
            idPais = Integer.parseInt(idCountry);

            if (listCiudad.getValue() != null) {
                String idCity = (String) listCiudad.getValue();
                idCiudad = Integer.parseInt(idCity);
            }

            String[] participantes = selectedOptions;

            this.getSession().setAttribute(ID_SESSION_PARTICIPACION_EVENTOS+"selectedOptions", this.getSelectedOptions());


            String idTipEvt = (String) listTEvento.getValue();
            idTipoEvento = Integer.parseInt(idTipEvt);

            nombreEvento = (String) textNomEvento.getValue();
            organizador = (String) textOrganizador.getValue();

            java.util.Date fechaIni = (java.util.Date) calendarioInicio.getValue();
            java.util.Date fechaEnd = (java.util.Date) calendarioFin.getValue();



            duracion = (String) textDuracion.getValue();
            listDur = (String) listTiempo.getValue();
            detalleCosto = (String) textAreadetalle.getValue();
            asumeCosto = (String) textFieldAsume.getValue();
            descripcion = (String) textAreaDesc.getValue();
            importanciaITM = (String) textAreaImport.getValue();

            idGrupo = (Integer) hiddenIdGrupo.getValue();
            costoXPersona = (String) textCostpersona.getValue();
            justificacion = (String) textAreaJust.getValue();
            aporteAProyectosInternos = (String) textAreaAporte.getValue();
            beneficios = (String) textAreaBeneficios.getValue();
            aprobacion = (String) textFieldAprob.getValue();

            grupoInvVO = new GrupoInvestigacionVO();
            grupoInvVO.setIdGrupo(idGrupo);
            getRequestBean1().setGrupoInvVO(grupoInvVO);

            if (idLinea == 0) {
                error("Por favor seleccione la línea de investigación.");
                return null;
            } else if (participantes == null) {
                error("Por favor seleccione los participantes del evento.");
                return null;
            } else if (idTipoEvento == 0) {
                error("Por favor seleccione el tipo de evento.");
                return null;
            } else if (nombreEvento == null || nombreEvento.equals("")) {
                error("Por favor digíte el nombre del evento.");
                return null;
            } else if (idPais == 0) {
                error("Por favor seleccione el país.");
                return null;
            } else if (idCiudad == 0) {
                error("Por favor seleccione la ciudad.");
                return null;
            } else if (organizador == null || organizador.equals("")) {
                error("Por favor digite el nombre del organizador.");
                return null;
            } else if (fechaIni == null) {
                error("Por favor digite la fecha de inicio del evento.");
                return null;
            } else if (fechaEnd == null) {
                error("Por favor digite la fecha final del evento.");
                return null;
            }else if(fechaIni.getTime()>fechaEnd.getTime()){
                error("La fecha inicial debe ser menor que la fecha final");
                return null;
            } else if (duracion == null || duracion.equals("")) {
                error("Por favor digite la duracion del evento.");
                return null;
            }else if (!esNumericoRegex(duracion)){
                error("La duración solo permite valores numéricos");
                return null;
            } else if (costoXPersona == null || costoXPersona.equals("")) {
                error("Por favor digite el costo por persona.");
                return null;
            } else if(!esNumericoRegex(costoXPersona)){
                error("El costo por persona solo permite valores numéricos");
                return null;
            } else if (detalleCosto == null || detalleCosto.equals("")) {
                error("Por favor digite el detalle del costo.");
                return null;
            } else if (asumeCosto == null || asumeCosto.equals("")) {
                error("Por favor digite el representante que asume el costo.");
                return null;
            } else if (justificacion == null || justificacion.equals("")) {
                error("Justificación es requerido.");
                return null;
            } else if (descripcion == null || descripcion.equals("")) {
                error("Descripción es requerido.");
                return null;
            } else if (importanciaITM == null || importanciaITM.equals("")) {
                error("Importancia para el ITM es requerido.");
                return null;
            } else if (aporteAProyectosInternos == null || aporteAProyectosInternos.equals("")) {
                error("Aporte a proyectos internos es requerido.");
                return null;
            } else if (beneficios == null || beneficios.equals("")) {
                error("Beneficios es requerido.");
                return null;
            } else if (aprobacion == null || aprobacion.equals("")) {
                error("Aprobación es requerido.");
                return null;
            }
            fechaInicio = new Date(fechaIni.getTime());
            fechaFin = new Date(fechaEnd.getTime());

            eventoVO.setIdLinea(idLinea);
            eventoVO.setIdGrupo(idGrupo);
            eventoVO.setIdTipoEvento(idTipoEvento);
            eventoVO.setNombreEvento(nombreEvento);
            eventoVO.setIdPais(idPais);
            eventoVO.setIdCiudad(idCiudad);
            eventoVO.setOrganizador(organizador);
            eventoVO.setFechaInicio(fechaInicio);
            eventoVO.setFechaFin(fechaFin);
            eventoVO.setDuracion(duracion + " " + listDur);
            eventoVO.setCostoXPersona(costoXPersona);
            eventoVO.setDetalleCosto(detalleCosto);
            eventoVO.setAsumeCosto(asumeCosto);
            eventoVO.setJustificacion(justificacion);
            eventoVO.setDescripcion(descripcion);
            eventoVO.setImportanciaITM(importanciaITM);
            eventoVO.setAporteProyectInt(aporteAProyectosInternos);
            eventoVO.setBeneficios(beneficios);
            eventoVO.setAprobacion(aprobacion);
            resultado = grupoInvBO.crearEvento(eventoVO);

            if (resultado == 0) {
                error("ha ocurrido un error al insertar los datos.");
            } else {
                textFieldIdEvento.setValue(resultado);
                resultadoParticipantes = insertarParticipantesEvento(participantes, resultado, idGrupo);
                if (!resultadoParticipantes.equals("agrego")) {
                    error("error al ingresas el evento");
                    return null;
                }
                info("el evento se ha ingresado Correctamente.");
                buttonAnexarInfo.setDisabled(false);
            }
        } catch (Exception e) {
            error("Error al ingresar el evento.");
            e.printStackTrace();
        }
        return "OK";
    }

    private boolean esNumericoRegex(String numero){
      Pattern p = Pattern.compile("[0-9]+");
      Matcher m = p.matcher(numero);
      return m.matches();
    }

    public void listPais_processValueChange(ValueChangeEvent vce) {
        String valP = (String) vce.getNewValue();
        int idP = Integer.parseInt(valP);
        int idC = 0;
        String ciudad = "";
        PaisVO paisVO;
        List<CiudadVO> listaCiudades = new ArrayList<CiudadVO>();
        List collection = new ArrayList();
        UISelectItems listMenu = new UISelectItems();

        if (!getListCiudad().getChildren().isEmpty()) {
            getListCiudad().getChildren().clear();
        }
        try {
            paisVO = new PaisVO();
            grupoInvBO = new GrupoInvestigacionBO();
            paisVO.setIdPais(idP);
            listaCiudades = grupoInvBO.listarCiudadesByPais(paisVO);
            collection.add(new SelectItem(0, "Seleccione una Ciudad"));
            for (int i = 0; i < listaCiudades.size(); i++) {
                idC = listaCiudades.get(i).getIdCiudad();
                ciudad = listaCiudades.get(i).getCiudad();
                collection.add(new SelectItem(idC, ciudad));
            } // end for            
            listMenu.setValue(collection);
            getListCiudad().getChildren().add(listMenu);
        } catch (Exception e) {
            e.getStackTrace();
        }

        grupoInvVO = new GrupoInvestigacionVO();
        idGrupo = (Integer) hiddenIdGrupo.getValue();
        grupoInvVO.setIdGrupo(idGrupo);
        getRequestBean1().setGrupoInvVO(grupoInvVO);
    }

    private String insertarParticipantesEvento(String[] participantes, int idEvento, int igGrupo) throws Exception {
        // Try Catch Exception
        // This clip shows how to create a try/catch
        // statement to handle possible exceptions
        int idParti = 0;
        String part = "", resultado = "";
        try {
            // TODO: Insert logic that may cause an exception
            // for example, performing database logic or file access
            for (int i = 0; i < participantes.length; i++) {
                eventoPersonaGrupoVO = new EventoPersonaGrupoVO();
                grupoInvBO = new GrupoInvestigacionBO();
                part = new String();
                part = participantes[i];
                idParti = Integer.parseInt(part);
                eventoPersonaGrupoVO.setIdEvento(idEvento);
                eventoPersonaGrupoVO.setIdPersona(idParti);
                eventoPersonaGrupoVO.setIdGrupo(idGrupo);
                resultado = grupoInvBO.insertarParticipantes(eventoPersonaGrupoVO);
                if (!resultado.equals("agrego")) {
                    error("Error al ingresar los participantes del evento.");
                    return null;
                }
            }
        } catch (Exception e) {
            // print exception information in the server log
            error("error al ingresar los participantes" + e);
        }
        return resultado;
    }

    public String botonAdjuntar_action() {
        UploadedFile uploadedFile = this.fileUploadAnexo.getUploadedFile();
        Archivo archivo = new Archivo();
        if(uploadedFile != null){
        if (uploadedFile.getContentType().equals("application/pdf")) {
            try {
                ServletContext context = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
                String path = context.getRealPath("/") + PATH_UPLOAD_EVENTOS;
                nombreArchivo = textNombreArchivo.getValue().toString();
                archivo.uploadFile(uploadedFile, nombreArchivo, path);
                textFieldArchivoAdjunto.setValue(path + textNombreArchivo.getValue().toString() + ".pdf");
                grupoInvVO = new GrupoInvestigacionVO();
                idGrupo = (Integer) hiddenIdGrupo.getValue();
                grupoInvVO.setIdGrupo(idGrupo);
                getRequestBean1().setGrupoInvVO(grupoInvVO);
                tabSetPartEvt.setSelected(tabAnexo.getId().toString());
            } catch (ArchivoException ex) {
                Logger.getLogger(ParticipacionEventos.class.getName()).log(Level.SEVERE, null, ex);
                ex.printStackTrace();
                error("Error al adjuntar el archivo");
            }
        } else {
            error("Solo se admiten archivos en formato PDF");
        }
        }else{
            error("El máximo tamaño permitido es de 10MB");
        }
        return null;
    }

    public String botonGuardarArchivo_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        archivoVO = new ArchivoVO();
        int resultado = 0;
        try {
            grupoInvBO = new GrupoInvestigacionBO();
            idEvento = (Integer) textFieldIdEvento.getValue();
            idGrupo = (Integer) textFieldIdGrupo.getValue();
            nombreArchivo = (String) textNombreArchivo.getValue();
            descripcionArchivo = (String) textAreaDescripcionArchivo.getValue();
            rutaArchivo = (String) textFieldArchivoAdjunto.getValue();
            fechaArchivo = (Date) textFieldFechaArchivo.getValue();

            grupoInvVO = new GrupoInvestigacionVO();
            idGrupo = (Integer) hiddenIdGrupo.getValue();
            grupoInvVO.setIdGrupo(idGrupo);
            getRequestBean1().setGrupoInvVO(grupoInvVO);

            if (idGrupo == 0) {
                error("no hay un grupo vinculado.");
                return null;
            } else if (nombreArchivo == null || nombreArchivo.equals("")) {
                error("Por favor digíte el nombre del del archivo.");
                return null;
            } else if (descripcionArchivo == null || descripcionArchivo.equals("")) {
                error("Por favor digite la descripción del archivo.");
                return null;
            } else if (rutaArchivo == null || rutaArchivo.equals("")) {
                error("No se ha adjuntado el archivo.");
                return null;
            } else if (fechaArchivo == null) {
                error("Fallo al obtener la fecha.");
                return null;
            }
            archivoVO.setIdModulo(idEvento);
            archivoVO.setNombreArchivo(nombreArchivo);
            archivoVO.setDescripcion(descripcionArchivo);
            archivoVO.setRutaArchivo(rutaArchivo);
            archivoVO.setFechaArchivo(fechaArchivo);
            resultado = grupoInvBO.guardarArchivoEvento(archivoVO);

            if (resultado == 0) {
                error("Error al guardar el anexo");
            } else {
               info("El archivo se guardo correctamente");
            }
        } catch (Exception e) {
            error("Error al guardar el anexo" + e);
            e.getStackTrace();
        }
        return null;
    }



    public String buttonAnexarInfo_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        tabSetPartEvt.setSelected(tabAnexo.getId().toString());
        return null;
    }

    public String botonVolver_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.       
        tabSetPartEvt.setSelected(tabPartEvento.getId().toString());
        if(this.getSession().getAttribute(ID_SESSION_PARTICIPACION_EVENTOS+"selectedOptions")!=null){
            this.setSelectedOptions((String[]) this.getSession().getAttribute(ID_SESSION_PARTICIPACION_EVENTOS+"selectedOptions"));
        }
        return null;
    }

    public HttpSession getSession() {
        return (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
    }

    public void setSession(HttpSession session) {
        this.session = session;
    }

    
}

